// CODEMIRROR STYLING

// Don't use text cursor on the scrollbar
.CodeMirror-vscrollbar { cursor:default; }

.CodeMirror {
  line-height:1.4375;
  user-select:text;
  background-color: inherit; // Override the codemirror.css default

  // This directive prevents strange colour artifacts when a document is open
  // that has less lines of code than fit into the window (especially notable
  // in dark mode, as the sizer is visible with a small green halo).
  .CodeMirror-sizer { height: 100%; }

  pre { padding:0; }

  input[type="checkbox"] {
    transform: scale(1.2);
    margin:0.2em;
  }

  .search-result {
    background-color: yellow;
    color: black !important;
  }

  .cm-table {
    font-family: @font-code;
    font-size: @font-mono-size;
    font-weight:bold;
  }

  .size-header-1 {
    font-size:2em;
    .CodeMirror-gutter-elt { line-height: 1.5em; }
  }
  .size-header-2 {
    font-size:1.8em;
    .CodeMirror-gutter-elt { line-height: 1.5em; }
  }
  .size-header-3 {
    font-size:1.5em;
    .CodeMirror-gutter-elt { line-height: 1.4em; }
  }
  .size-header-4 {
    font-size:1.3em;
    .CodeMirror-gutter-elt { line-height: 1.3em; }
  }
  .size-header-5 { font-size:1em; }
  .size-header-6 { font-size:1em; }

  .cm-comment,
  .cm-formatting-task,
  .cm-fenced-code { font-family: @font-code; font-size: @font-mono-size; }

  .CodeMirror-cursor {
    width: 2px;
    border: 0;
    z-index: 1;
    animation: soft-blink @cursor-blink-rate infinite; // Use the "soft-blink" animation
  }

  /* Make the formatting characters and escape sequences nearly invisible */
  .cm-formatting-code,
  .cm-formatting-code-block,
  .cm-formatting-quote,
  .cm-formatting-strong,
  .cm-formatting-em,
  .cm-escape-char { opacity:.3; }

  .cm-formatting-list-ul,
  .cm-formatting-list-ol {
    font-family: @font-code;
    font-size: @font-mono-size;
  }

  .cm-url, .cm-link { text-decoration: none; }

  // Meta-key adaptions
  .cm-zkn-tag.meta-key, .cm-zkn-link.meta-key, .cma.meta-key { cursor: pointer; }
  .cm-zkn-tag.meta-key:hover,
  .cm-zkn-link.meta-key:hover,
  a.cma.meta-key:hover { text-decoration: underline; }

  .cm-zkn-tag { font-weight:bold; }

  // Text-folding related stuff
  .CodeMirror-gutters {
    background-color: transparent;
    border: none;
    left: 0 !important;
  }
  .CodeMirror-foldgutter { width: .7em; }
  .CodeMirror-foldgutter-open, .CodeMirror-foldgutter-folded {
    cursor: pointer;
    font-size: 18px;
  }
  .CodeMirror-foldgutter-open:after { content: "\25BE"; }
  .CodeMirror-foldgutter-folded:after { content: "\25B8"; }

  .CodeMirror-foldmarker {
    border-radius:@border-radius;
    display: inline-block;
    font-size: 75%;
    margin-left: 10px;
    padding:2px;
    cursor: pointer;
    vertical-align: baseline;
  }
}

.heading-tag {
  font-size: 20px;
  font-weight: normal;
  cursor: pointer;
  border-radius: @border-radius;
  padding: 4px;
}

// Hints (tag autocompletion, etc.)
.CodeMirror-hints {
  position: absolute;
  z-index: 10;
  overflow: hidden;
  list-style: none;

  margin: 0;
  padding: 0px;

  max-height: 20em;
  overflow-y: auto;
  li.CodeMirror-hint {
    margin: 0;
    white-space: pre;
    cursor: pointer;
    padding: 5px;
    line-height: 150%;
  }

  // Apply a bolder font weight to tags that have a specific colour assigned.
  .cm-hint-colour { font-weight: bold; }
}
